ALTER PROCEDURE sp_Get_Constantes_BynConCodigo
    @nConCodigo INT ,
    @cConValor VARCHAR(50)
AS 
    BEGIN

        DECLARE @sql VARCHAR(MAX)
        SET @sql = '
        SELECT  nConCodigo ,
                nConValor ,
                cConDescripcion
        FROM    dbo.Constante
        WHERE   nConCodigo = ' + CAST(@nConCodigo AS VARCHAR(8)) 
		
        IF @cConValor <> 'ALL' 
            BEGIN
  
                SET @sql = @sql + ' AND  nConValor IN ( ' + @cConValor + ' ) '				
            END          

        EXEC ( @sql )

    END


--sp_Get_Constantes_BynConCodigo 1063,''    